<!DOCTYPE html>
<html lang="en">
{% load staticfiles %}

<head>
    <meta charset="UTF-8">
    <title>{% block title %}{% endblock %}</title>
    <link rel="stylesheet" href="{% static 'css/font-awesome.css' %}">
    <link rel="stylesheet" href="{% static 'files/css/list.css' %}">
    {% block custome_css %}{% endblock %}
</head>

<body>
    {#导航栏#}
    <div class="nav">
        <div class="nav-left">某某公司文件管理系统</div>
        <div class="nav-right">
            <div class="nav-right-name">{{ request.user.username }}<i class="fa fa-caret-down" aria-hidden="true"></i>
                <dl class="nav-right-logout">
                    <dd><a href="{% url 'users:pwd_modify' %}">修改密码</a></dd>
                    <dd><a href="{% url 'users:logout' %}">退&nbsp&nbsp&nbsp&nbsp出</a></dd>
                </dl>
            </div>
        </div>
    </div>

    {#侧边栏#}
    <div class="sidebar" id="sidebar">
        <ul>
            <li {% ifequal request.path '/' %}class="active-li"{% endifequal %}><a href="{% url 'index' %}"><i class="fa fa-table" aria-hidden="true"></i><span>文件列表</span></a></li>
            {#仅超级管理员和系统管理员有以下四个界面#}
            {% if request.user.role == '2' or request.user.is_superuser == 1 %}
                <li {% ifequal request.path|slice:18 '/files/approvelist' %}class="active-li"{% endifequal %}><a href="{% url 'files:approvelist' %}"><i class="fa fa-list" aria-hidden="true"></i><span class="">审批列表</span></a></li>
                <li {% ifequal request.path|slice:11 '/users/list' %}class="active-li"{% endifequal %}><a href="{% url 'users:list' %}"><i class="fa fa-user" aria-hidden="true"></i><span class="">人员管理</span></a></li>
                <li {% ifequal request.path|slice:17 '/files/public_ip' %}class="active-li"{% endifequal %}><a href="{% url 'files:public_ip' %}"><i class="fa fa-cog" aria-hidden="true"></i><span class="">设置</span></a></li>
            {% endif %}
            {% if request.user.role == '2' or request.user.role == '3' or request.user.is_superuser == 1 %}
                <li {% ifequal request.path|slice:17 '/files/approvelog' %}class="active-li"{% endifequal %}><a href="{% url 'files:approvelog' %}"><i class="fa fa-bars" aria-hidden="true"></i><span class="">审批记录</span></a></li>
            {% endif %}
            <li {% ifequal request.path|slice:18 '/users/operate_log' %}class="active-li"{% endifequal %}><a href="{% url 'users:operate_log' %}"><i class="fa fa-book" aria-hidden="true"></i><span class="">操作日志</span></a></li>
        </ul>
    </div>

    {#内容栏#}
    <div class="wrapper">
        {% block content %}{% endblock %}
    </div>

    {#通用js代码#}
    <script>
        {#调整侧边框的高度，下面的48是导航栏的高度#}
        var sidebar = document.getElementById("sidebar");
        var content_height = document.body.scrollHeight>window.innerHeight?document.body.scrollHeight-48:window.innerHeight-48;
        sidebar.style.height = content_height+'px';
    </script>

    {#不同页面自定义js代码#}
    {% block custome_js %}{% endblock %}
</body>

</html>
